package com.client.web;

import com.client.dao.StudentDao;
import com.client.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * UserController
 *
 * @author humdeef
 * @date 2018/11/12
 */
@RestController
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private StudentDao studentDao;

    @RequestMapping("/save")
    public String save(@RequestParam Long id, @RequestParam String name, @RequestParam Integer age, @RequestParam Integer sex) {
        Student o = new Student();
        o.setId(id);
        o.setName(name);
        o.setAge(age);
        o.setSex(sex);
        o.setCtime(new Date());
        int save = studentDao.save(o);
        return "Ok";
    }
}
